/*
 * @Author: guoyangf
 * @Date: 2020-07-02 15:06:36
 * @LastEditTime: 2020-09-21 16:14:06
 * @Description: 通用业务事件。
 */
import { pageTo, print, toast, cacheTools, viewModel, cardCache } from 'nc-lightapp-front'
import urlHandle from 'ssccommon/utils/urlHandle';
import { requestPromise } from 'ssccommon/utils/asyncFunctions.js';
import { imagAndVoucherHandle } from '../../util/imagAndVoucherHandle';
import { thumbListScrollLoad } from 'ssccommon/utils/scrollLoad';

let { deleteCacheById } = cardCache;
/**
 *打开单据详情页
 * 行双击、点击billno、翻页时间都会调用此方法
 */
async function openBill(record, index) {

    //currentRowData 不使用平台组件回调的record。统一从领域维护的数据结构中取，保证对象引用一致。从而保证行状态一致。
    let currentRowData = record;


    let pageNumInDetail = index + 1; //详情页翻页器序号
    delete currentRowData.key; //表格组件多了一个key字段，领域强制删掉。
    this.currentRowIndex = index;
    this.currentRowData = currentRowData;
    this.currentGridData = {
        //列表区编码与页签编码相同
        [this.state.activeTabKey]: { areaType: 'table', rows: [{ values: currentRowData }] }
    }

    let data = await this.requestApi.openBill(this.currentGridData);

    let params = data.data.data;
    let scene = 'zycl';



    //打开凭证单据页面需要。（下面类型判断多语三个时，抽取工具函数。）
    if (data.data.opentype == "voucher" && params.cachekey && params.pklist) {
        cacheTools.set(params.cachekey, params.pklist)
    }



    let approveUrl = urlHandle(data, 'scene=' + scene + `&deal=${this.state.activeTabKey}`, null, 'ssc-bill-detail-iframe');

    //出纳驳回原因
    let cashierRejectReason = this.currentRowData.cmprejectinfo ? this.currentRowData.cmprejectinfo.value : '';

    this.setState({
        approveUrl,
        reason: cashierRejectReason,
        pageNumInDetail,
        handleReason: this.currentRowData.reason ? this.currentRowData.reason.value : '',
        currentRowSagaStatus: this.currentRowData.saga_status.value,
        /*  alarm: false,
        hitMessage: '' */
    }, () => {
        pageTo.addUrlParam({
            c: params.appcode,
            p: params.pagecode,
            n: params.appname,
            custom: JSON.stringify({
                pk_group: this.currentRowData.pk_group.value
            })
        })

        //侧边栏
        //let pk_task = this.currentRowData.pk_task.value;
        let queryPointParam = this.currentGridData;
        if (this.props.sscAppType == 'sscapprove') { //我的审批需要额外加iscreate 请求字段
            queryPointParam = {
                ...this.currentGridData,
                userjson: JSON.stringify({ iscreate: 'Y' })
            }
        }
        this.state.sideBarQueryUrl && this.auditPointBarInst.setPointTreeData(queryPointParam);

    })

    // 信用是否设置
    /* let isCreditInstall
    requestApi.queryCredits({
        queryMethod: 'isCreditInstall',
        success: (data) => {
            isCreditInstall = data.data.isCreditInstall
            that.setState({ isCreditInstall })
            if (isCreditInstall) {
                // 信用等级
                requestApi.queryCredits({
                    queryMethod: 'queryCreditLevel',
                    success: (data) => {
                        let levels = data.data
                        if (levels.length > 5) levels.length = 5
                        that.setState({ levels }, () => {
                            // 查询信用信息详情
                            requestApi.queryCredits({
                                queryMethod: 'queryCreditInfo',
                                billMakerId: this.currentRowData.billmaker.value,
                                success: (data) => {
                                    that.setState({ creditLevelInfo: data.data })
                                }
                            })
                        })
                    }
                })
            }
        }
    }) */

    //是否有预警消息
    /* requestApi.queryBudgetMessage({
        data: {
            busiid: this.currentRowData.busiid.value,
            billtype: this.currentRowData.transtypecode.value,
            pk_group: this.currentRowData.pk_group.value
        },
        success: (data) => {
            if (data.data && data.data['alarm']) {
                that.setState({
                    alarm: data.data['alarm'],
                    hitMessage: data.data['message']
                })
            }
        }
    }) */

    //打开影像和展示联查凭证按钮处理逻辑
    /* imagAndVoucherHandle.call(that); */

    this.setState({
        showDetailPage: true
    }, () => {
        this.setButtonStatus();
        this.props.cardPagination.setCardPaginationId({ id: this.currentTabPkList[index] });
    })

    imagAndVoucherHandle.call(this)

    //手动驳回原因:第一次打开时如果有，则显示。  出纳驳回与手动驳回用同一个变量， 两个原因不会同时存在
    let manualReasonResult = await this.requestApi.manualReasonQry({
        pk: this.currentRowData.pk_currenttask.value,
    })
    if (manualReasonResult.success) {
        this.setState({
            handleReason: manualReasonResult.data
        })
    }
}

async function queryData() {

    let tabCode = this.state.activeTabKey;

    let result = await this.requestApi.query(this.queryParam);

    this.lastQueryTime = result.data.lastQueryTime;

    if (tabCode == 'todo') { //待办页签 pklist是不确定的，需要轮询查询pklist
        intervalToDoTabListPkRefresh.call(this)
    } else {
        //清除轮询查询
        clearInterval(this.pkListRefreshTimer)
    }

    this.currentTabPkList = result.data.taskPkList;

    //数据兼容
    (result.data.tasklist && result.data.tasklist.rows) || (result.data.tasklist = { rows: [] });
    (result.data.taskcard && result.data.taskcard.rows) || (result.data.taskcard = { templets: {} });

    //处理查询区字段可扩展的值，如单据类型
    let extendableSearchFieldValueArr = (result.data.searchArea && result.data.searchArea.items) || [];
    let extendableSearchFieldValueObj = {};
    extendableSearchFieldValueArr.forEach((item) => {
        extendableSearchFieldValueObj[item.attrcode] = item;
    })

    this.currentTablePagePks = this.currentTabPkList.slice(0, +this.queryParam.pageinfo.size)

    let listConfigArr = this.state.listConfigArr;
    let targetListConfig = listConfigArr.find(config => config.tabCode == tabCode);

    let cardRows = this.tableCardDataHandle(null, result.data.taskcard, result.data.tasklist);

    targetListConfig.firstPageRowData = {
        rows: result.data.tasklist.rows,  //注意tasklist中要包含pageinfo信息，否则分页不对
        allpks: this.currentTabPkList,
        pageInfo: {
            total: +this.currentTabPkList.length,
            pageSize: +this.queryParam.pageinfo.size,
            totalPage: +result.data.tasklist.pageinfo.totalPages,
            pageIndex: 0
        }
    };
    targetListConfig.cardData.cardRows = cardRows;
    targetListConfig.cardData.listRows = result.data.tasklist.rows;
    targetListConfig.cardTpl = this.tableCardTplHandle(result.data.taskcard.templets);


    //更新页签数量
    let tabData = this.state.tabData;
    tabData.forEach((tab) => {
        tab.billCount = result.data[tab.attrcode];
    })

    this.setState({
        listConfigArr,
        extendableSearchFieldValueObj,
        tabData
    }, () => {
        // this.props.table.updateTableHeight();
    })
}

/**
 *根据pk查询数据
 *
 * @param {*} pks
 */
async function queryDataByPks(pks) { //详情页通过翻页器
    let tabCode = this.state.activeTabKey;
    let reqParam = {
        pk_task: pks,
        tabcode: tabCode
    }
    try {
        let result = await this.requestApi.queryByPks(reqParam);
        return result;

    } catch (e) {
    } finally {
        this.canScrollLoadFlag = true;
    }

}

/**
 *
 * 滚动加载数据
 */
async function scrollLoadListData() {
    if (this.canScrollLoadFlag) {
        let tabCode = this.state.activeTabKey;
        let listConfigArr = this.state.listConfigArr;
        let targetListConfig = listConfigArr.find(config => config.tabCode == tabCode);
        let currentRowLength = targetListConfig.cardData.cardRows.length;
        if (currentRowLength < this.currentTabPkList.length) {
            this.canScrollLoadFlag = false;
            let pks = this.currentTabPkList.slice(currentRowLength, currentRowLength + this.queryParam.pageinfo.size)
            let result = await this.queryDataByPks(pks);
            let cardRows = this.tableCardDataHandle(null, result.data.taskcard, result.data.tasklist);

            cardRows = [...targetListConfig.cardData.cardRows, ...cardRows];
            let listRows = [...targetListConfig.cardData.listRows, ...result.data.tasklist.rows];
            targetListConfig.cardData = { cardRows, listRows };
            this.setState({
                listConfigArr
            })

        }
    }

}

function goBack() {
    if (!this.checkBillIsEditStatus()) {
        this.setState({
            showDetailPage: false
        })
        this.queryData();
    }
}

//单据打印、凭证打印、一键打印
async function commonPrint(url, record) {
    let curentTableArea = this.state.activeTabKey;
    let checkedRows = this.props.table.getCheckedRows(curentTableArea) || [];

    if (!checkedRows.length) {
        checkedRows = [{ data: { values: record } }]
    }
    let printTaskInfoArr = [];
    checkedRows.forEach((row) => {
        let values = row.data.values;
        let info = {
            billno: values.billno.value,
            pk_org: values.pk_org.value,
            pk_group: values.pk_group.value,
            busiid: values.busiid.value,
            billtypecode: values.billtypecode.value,
            transtypecode: values.transtypecode.value
        };
        printTaskInfoArr.push(info);
    })

    let randomNum = new Date().getTime();
    print(
        'pdf',  //支持两类: 'html'为模板打印, 'pdf'为pdf打印
        url, //后台服务url
        {
            funcode: '701001SSCPRINT',
            nodekey: 'GXDY',
            oids: ['sscprint'],    // 功能节点的数据主键
            userjson: JSON.stringify({
                'srcpage': this.state.activeTabKey,
                'printtaskid': randomNum,
                'printtaskinfo': printTaskInfoArr
            })
        }
    )

    let currentTime = new Date().getTime();
    let getPrintResult = () => {
        let intervalNum = setTimeout(async () => {
            if (new Date().getTime() - currentTime > 60000) {
                clearTimeout(intervalNum);
            }
            let printInfoResult = await this.requestApi.printInfo(randomNum);
            if (printInfoResult.success) {
                if (printInfoResult.data) {
                    if (printInfoResult.data == 'ErrorInfoIsNull') {
                        toast({
                            title: this.state.multiLang['job-file-dycg'] /*打印成功*/
                        })
                    } else {
                        toast({ title: printInfoResult.data, color: 'danger' }) /*打印失败*/
                    }

                    if (this.state.activeTabKey != 'done') {
                        let result = await this.queryData();
                        //批量打印时，因为后台接口不能准确返回打印失败的字段。所以要用上面的重新查询数据。
                        // let allRows = this.props.table.getAllTableData(curentTableArea).rows;
                        // let indexArr = []
                        // printTaskInfoArr.forEach((sRow) => {
                        //     let billno = sRow.billno;
                        //     allRows.find((row, index) => {
                        //         if (row.values.billno.value == billno) {
                        //             indexArr.push(index);
                        //             return true;
                        //         }
                        //     })
                        // })
                        // this.props.table.deleteTableRowsByIndex(curentTableArea, indexArr);
                        //deleteRowAndRefreshCountByListBtn.call(this);
                    }
                    clearTimeout(intervalNum);
                } else {
                    getPrintResult();
                }
            } else {
                clearTimeout(intervalNum);
            }
        }, 1000)
    }
    getPrintResult();





}

/**
 * 拒绝弹窗确认事件
 */
async function rejectModalConfirmEvent(reqParam) {
    try {
        const result = await requestPromise({
            url: '/nccloud/' + this.currentRowData.module.value + '/ssctp/sscbd/SSCTaskHandleRejectAction.do',
            data: {
                ...this.currentGridData,
                userjson: JSON.stringify({
                    actiontype: 'sscreject',
                    ...reqParam,
                    ...this.state.sideBarQueryUrl && this.auditPointBarInst.getAuditData(true)
                })
            }
        });
        if (result.success) {
            toast({
                title: this.state.multiLang['job-approve-bhcg'] /*驳回成功*/
            })

            this.currentRowData.taskstatus.value = this.presetVar.sscApproveBillStatusEnum.reject;
            this.currentRowData.ts.value = result.data.ts;
            this.setButtonStatus();
            this.reloadSubPage();
        }
    } catch (e) {
        toast({ title: e.message, duration: 5, color: 'danger', })
    }
}

//列表控件操作列按钮前事件
function listBtnBeforeEvent(key, record, index) {
    delete record.key;
    this.currentRowIndex = index;
    this.currentRowData = record;
    this.currentGridData = {
        //列表区编码与页签编码相同
        [this.state.activeTabKey]: { areaType: 'table', rows: [{ values: this.currentRowData }] }
    }
}

/**
 * 此方法暂时不用
 * 通过currentRowIndex分别获取表格和缩略索引。
 * @param {}} index 
 */
function getTableAndCardCurrentRowIndex() {
    let temp = {};
    let index = this.currentRowIndex;
    let currentTablePageInfo = this.props.table.getTablePageInfo(this.state.activeTabKey);

    if (this.targetListConfig.showCardList) {

        temp.card = index;
        temp.table = index % currentTablePageInfo.pageSize;
    } else {
        temp.table = index;
        temp.card = currentTablePageInfo.pageIndex * currentTablePageInfo.pageSize + index;

    }
    return temp;

}
//列表控件操作列按钮后事件
function btnAfterEvent(key, record) {
    deleteRowAndRefreshCountByListBtn.call(this);
}


/**
 * 原因弹窗保存成功回调： 申请调整、取消调整、挂起、取消挂起
 */
function reasonModalSaveSuccessCallback(action, result) {
    /* let taskstatus = null;
    let billStatusEnum = this.presetVar.sscApproveBillStatusEnum;
    switch (action) {
        case 'adjust':
            taskstatus = billStatusEnum.adjust;
            break;
        case 'un-adjust':
            taskstatus = billStatusEnum.taken;
            break;
        case 'handon':
            taskstatus = billStatusEnum.handon;
            break;
        case 'un-handon':
            taskstatus = billStatusEnum.taken;
            break;
    } */

    let row = result.data.tasklist.rows[0].values;
    this.currentRowData.taskstatus.value = row.taskstatus.value;
    this.currentRowData.ts.value = row.ts.value;

    this.setButtonStatus();

    //在详情页时，如果不是挂起。 需要重置侧边栏状态 
    if (this.state.showDetailPage && action != 'handon' && action != 'un-handon') {
        this.state.sideBarQueryUrl && this.auditPointBarInst.resetData();
    }

    deleteRowAndRefreshCountByListBtn.call(this);

}

//定向提取
async function diractionalTakeQuery(queryCondition) {
    let searchTpl = this.props.meta.getMeta()['search_Area'];
    let oid = searchTpl.oid;

    let result = await this.requestApi.taskTakeAction(
        {
            querycondition: queryCondition,
            oid,
            queryAreaCode: 'search_Area',
            querytype: 'tree',
            pagecode: this.state.activeTabKey
        }
    )
    if (result.success) {
        //重置查询条件，然后查询
        let currentSearchCtrlInst = this[`${this.state.activeTabKey}_SearchCtrl`];
        currentSearchCtrlInst.resetSearchAreaFiledAndQuery();
    }
}

/**
 * 排序回调
 *
 * @param {*} sortParam
 */
async function sortCallback(sortParam) {
    if (sortParam[0].order == 'flatscend') {
        this.queryParam.orderByInfo = [];
    } else {
        this.queryParam.orderByInfo = sortParam;
    }
    await this.queryData();

    //以下代码为了控制表头的排序图标和更改sortParam参数
    let sortObj = {};
    sortParam.forEach(item => {
        sortObj[item.field] = item;
    });
    let meta = this.props.meta.getMeta()
    meta[this.state.activeTabKey].items.forEach(item => {
        //保存返回的column状态，没有则终止order状态
        if (sortObj[item.attrcode]) {
            item.order = sortObj[item.attrcode].order;
            item.orderNum = sortObj[item.attrcode].orderNum;
        } else {
            item.order = "flatscend";
            item.orderNum = "";
        }
    })
    this.props.meta.setMeta(meta);

}

async function todoTabListPkRefresh() {
    let result = await this.requestApi.inquiryPksIsChange({ lastQueryTime: this.lastQueryTime });
    let isChange = result.data.addNotice
    if (isChange) {

        // 提示消息
        toast({ color: "success", content: this.state.multiLang['job-common-yxdzyrw'] }); // 有新的作业任务。

        // 播放声音
        window.setTimeout(() => {
            try {
                this.audio.play();
            } catch (e) {
                console.log('不支持提示音。');
            }
        }, 100);

        getPkListAndTabCount.call(this);
    }
}

//更新tab和查询区count 
async function updateTabAndSearchCount(data) {
    let result = data;
    if (!result) {
        let specialQueryParam = JSON.parse(JSON.stringify(this.queryParam));
        specialQueryParam.pageinfo.size = 1; //将查询数据条数设为1

        result = await this.requestApi.query(this.queryParam);
    }


    //处理查询区字段可扩展的值，如单据类型
    let extendableSearchFieldValueArr = (result.data.searchArea && result.data.searchArea.items) || [];
    let extendableSearchFieldValueObj = {};
    extendableSearchFieldValueArr.forEach((item) => {
        extendableSearchFieldValueObj[item.attrcode] = item;
    })

    //更新页签数量
    let tabData = this.state.tabData;
    tabData.forEach((tab) => {
        tab.billCount = result.data[tab.attrcode];
    })
    this.setState({
        extendableSearchFieldValueObj,
        tabData,
    })
}

/**
 *获取最新pkList列表和tab和查询区计数。
 *  调用时机： 1、待处理页签轮巡时调用（需要更新pklist） 2、列表按钮操作完成后调用
 */
async function getPkListAndTabCount() {

    let specialQueryParam = JSON.parse(JSON.stringify(this.queryParam));
    specialQueryParam.pageinfo.size = 1; //将查询数据条数设为1

    let result = await this.requestApi.query(this.queryParam);

    this.lastQueryTime = result.data.lastQueryTime;

    //待处理页签需要对比处理pkList。 并补满当前页的数据
    let listConfigArr = this.state.listConfigArr;
    if (this.state.activeTabKey == 'todo') {
        let newPkList = result.data.taskPkList;
        let newPks = [];
        newPkList.forEach((pk, index) => {
            if (!this.currentTabPkList.some(cpk => cpk == pk)) {
                newPks.push(pk);
            }
        })

        //更新pk缓存 
        this.currentTabPkList = this.currentTabPkList.concat(newPks);
        let comPageInfo = this.props.table.getTablePageInfo(this.state.activeTabKey);

        //表格：刷新当前页数据和总页数。
        let tablePks = this.currentTabPkList.slice(comPageInfo.pageIndex * comPageInfo.pageSize, comPageInfo.pageIndex * comPageInfo.pageSize + comPageInfo.pageSize);
        let tableRowsResult = await this.queryDataByPks(tablePks);

        let currentTablePageRowData = {
            rows: tableRowsResult.data.tasklist.rows,  //注意tasklist中要包含pageinfo信息，否则分页不对
            allpks: this.currentTabPkList,
            pageInfo: {
                total: +this.currentTabPkList.length,
                pageSize: comPageInfo.pageSize,
                totalPage: Math.ceil(this.currentTabPkList.length / comPageInfo.pageSize),
                pageIndex: comPageInfo.pageIndex
            }
        };
        this.props.table.setAllTableData(this.state.activeTabKey, currentTablePageRowData);


        //判断卡片是否是完整页，如果不是，说明更新pk前卡片已经翻到最后一页，则刷新最后一页数据
        let targetListConfig = listConfigArr.find(config => config.tabCode == this.state.activeTabKey);
        let currentCardRows = targetListConfig.cardData.cardRows.length;
        if (currentCardRows % comPageInfo.pageSize != 0) {
            let queryCardPks = this.currentTabPkList.slice(currentCardRows, currentCardRows + (comPageInfo.pageSize - currentCardRows % comPageInfo.pageSize));
            if (queryCardPks.length) {
                let cardRowsResult = await this.queryDataByPks(queryCardPks);
                let cardRows = this.tableCardDataHandle(null, cardRowsResult.data.taskcard, cardRowsResult.data.tasklist);
                cardRows = [...targetListConfig.cardData.cardRows, ...cardRows];
                let listRows = [...targetListConfig.cardData.listRows, ...result.data.tasklist.rows];
                targetListConfig.cardData = { cardRows, listRows };
                targetListConfig.cardTpl = this.tableCardTplHandle(cardRowsResult.data.taskcard.templets);
                this.setState({
                    listConfigArr
                })
            }

        }
    }
    //更新页签数量
    this.updateTabAndSearchCount(result);
}

function intervalToDoTabListPkRefresh() {

    this.pkListRefreshTimer = setTimeout(() => {
        todoTabListPkRefresh.call(this);
        intervalToDoTabListPkRefresh.call(this);
    }, 15000);
}
/**
 *列表按钮操作后，删除行和刷新技术
 *
 */
function deleteRowAndRefreshCountByListBtn() {
    this.updateTabAndSearchCount();

    let index = this.currentRowIndex;
    let currentTablePageInfo = this.props.table.getTablePageInfo(this.state.activeTabKey);

    let currentTableRowIndex = null; //表格的当前行索引
    let currentCardRowIndex = null; //缩略图列表的当前行索引

    if (this.targetListConfig.showCardList) { //在缩略图视图
        currentCardRowIndex = index;
        currentTableRowIndex = index % currentTablePageInfo.pageSize;

        //this.props.table.deleteTableRowsByIndex(this.state.activeTabKey, currentTableRowIndex);
        //此时表格已被destory，不能调用上面那个方法。 调用下面的方法，才能将表格数据和统计同时变化。
        deleteCacheById("pk_task", this.currentTabPkList[index], this.state.activeTabKey);

    } else { //在table视图
        currentTableRowIndex = index;
        currentCardRowIndex = currentTablePageInfo.pageIndex * currentTablePageInfo.pageSize + index;
        this.props.table.deleteTableRowsByIndex(this.state.activeTabKey, currentTableRowIndex);
    }
    //删除pk
    this.currentTabPkList.splice(currentCardRowIndex, 1);
    //删除卡片对应行，如果有的话
    let targetListConfig = this.state.listConfigArr.find(config => config.tabCode == this.state.activeTabKey);
    let { cardRows, listRows } = targetListConfig.cardData;
    cardRows.splice(currentCardRowIndex, 1);
    listRows.splice(currentCardRowIndex, 1)
    this.setState({
        listConfigArr: this.state.listConfigArr
    })

}

/**
 *设置原因 （调整、取消调整、挂起、取消挂起、驳回组件需要）
 *
 * @param {*} handleReason
 */
function setHandleReason(handleReason) {
    this.setState({
        handleReason
    })
}

/**
 *检查iframe中的单据是否是编辑态, 编辑态时，所有按钮提示不可用
 *
 * @returns
 */
function checkBillIsEditStatus() {
    let iframeObj = document.getElementById('ssc-bill-detail-iframe');
    let contentDocument = iframeObj.contentDocument;
    if (contentDocument) {
        let domObj = contentDocument.querySelector('.form-component-item-wrapper.edit');
        if (domObj) {
            toast({ title: this.state.multiLang['job-common-qbcndxxxg'], color: 'warning' })
            return true;
        }
    }
    return false;
}

/**
 *详情页头部按钮 前 事件
 *
 * @returns
 */
function detailPageHeadBtnBeforeEvent() {
    //判断是否是编辑态，编辑态按钮不可用
    return !this.checkBillIsEditStatus();
}

//relaod iframe页面 更细状态
function reloadSubPage() {
    let iframeObj = document.getElementById("ssc-bill-detail-iframe");
    let url = iframeObj.getAttribute("src");
    if (url && url.indexOf("/nccloud/resources") === -1) {
        return;
    }

    //尝试直接调用iframe的刷新按钮来刷新单据数据
    let refrushBtn = iframeObj.contentWindow.document.getElementsByClassName("icon-shuaxin1");
    if (refrushBtn && refrushBtn.length > 0) {
        for (let i = 0; i < refrushBtn.length; i++) {
            refrushBtn[i].click();
        }
        return;
    }
    iframeObj.contentWindow.location.reload(true);

}

export {
    openBill, queryData, goBack, commonPrint, setHandleReason, checkBillIsEditStatus, detailPageHeadBtnBeforeEvent,
    listBtnBeforeEvent, btnAfterEvent, rejectModalConfirmEvent,
    reasonModalSaveSuccessCallback, diractionalTakeQuery,
    scrollLoadListData, queryDataByPks, sortCallback, todoTabListPkRefresh,
    getPkListAndTabCount,
    updateTabAndSearchCount,
    reloadSubPage,
    deleteRowAndRefreshCountByListBtn
}